package com.woniu.communitymanagement.controller;

import com.woniu.communitymanagement.entity.HttpResult;
import com.woniu.communitymanagement.entity.Parking;
import com.woniu.communitymanagement.service.ParkingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/parking")
@CrossOrigin(origins = "*")
public class ParkingController {
    @Autowired
    private ParkingService parkingService;
    @RequestMapping("/delete")
    public HttpResult delete(Integer id){
        return parkingService.deleteById(id);
    }
    @RequestMapping("/update")
    public HttpResult updateById(@RequestBody Parking parking){
        return parkingService.updateParkingById(parking);
    }
    @RequestMapping("/selectOne")
    public HttpResult selectOne(Integer id){
        return parkingService.selectOne(id);
    }
    @RequestMapping("/insert")
    public HttpResult insertOne(@RequestBody Parking parking){
        return parkingService.insertOne(parking);
    }
    @RequestMapping("/all")
    public HttpResult all(Integer id){
        return parkingService.all(id);
    }
    @RequestMapping("/list")
    public HttpResult list(String numbers,Integer pageIndex,Integer pageSize){
        return parkingService.selectParkingList(numbers,pageIndex,pageSize);
    }


}
